<template>
	<view>
		<view class="b1">
			<view class="title">
				新闻资讯
				<view class="more" @click="goto('/commonViews/News')">更多</view>
			</view>
			<view class="content">
				<view class="item" v-for="(item,index) in dataset" :key="index" @click="jumpTo(item.id, item.link_url)">
					<image :src="item.thumb" :alt="item.title" class="preview" mode="scaleToFill"></image>
					<view class="tx1">
						{{ item.title }}
					</view>
					<view class="tx2 clearfix">
						<!-- <view class="tip yc">原创</view> -->
						<view class="tip zz">转载</view>
						<view class="time">{{ item.addtime | timeFilter }}</view>
						<view class="see">{{ item.click }}</view>
						<view class="clear"></view>
					</view>
				</view>
			</view>
			<view class="form_split_18"></view>
		</view>
	</view>
</template>

<script>
	import {
		parseTime
	} from '@/utils/index'
	export default {
		name: 'NewsOne',
		props: ['dataset'],
		filters: {
			timeFilter(timestamp) {
				return parseTime(timestamp, '{y}-{m}-{d}')
			}
		},
		data() {
			return {}
		},
		methods: {
			jumpTo(id, url) {
				this.$emit('jumpTo', {
					id,
					url
				})
			},
			goto(path) {
				uni.navigateTo({
					url: path
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.b1 {
		.content {
			.item {
				.preview {
					position: absolute;
					left: 0;
					top: 50%;
					transform: translate(0, -50%);
					width: 176rpx;
					height: 126rpx;
					border-radius: 8rpx;
				}

				.tx2 {
					.tip {
						&.yc {
							background-color: #e7f3ff;
							color: #1787fb;
						}

						&.zz {
							background-color: #fff5e8;
							color: #ff6600;
						}

						position: absolute;
						left: 0;
						top: 18rpx;
						width:64rpx;
						text-align:center;
						padding: 0;
						border-radius: 6rpx;
						font-size: 22rpx;
					}

					.see {
						float: left;
						padding: 6rpx 0 6rpx 32rpx;
						font-size: 24rpx;
						color: #999999;
						background-image: $news_see;
						background-position: 0 center;
						background-repeat: no-repeat;
						background-size: 26rpx;
					}

					.time {
						float: left;
						padding: 6rpx 0 6rpx 32rpx;
						font-size: 24rpx;
						color: #999999;
						margin-right: 30rpx;
						background-image: $news_time;
						background-repeat: no-repeat;
						background-position: 0 10rpx;
						background-size: 24rpx;
						width: 185rpx;
					}

					padding: 11rpx 0 15rpx 80rpx;
					position: relative;
				}

				.tx1 {
					padding-top: 12rpx;
					font-size: 30rpx;
					color: #333333;
					height: 94rpx;
					line-height: 1.5;
					word-break: break-all;
					overflow: hidden;
				}

				&:not(:last-child) {
					border-bottom: 2rpx solid #f3f3f3;
				}

				position: relative;
				padding-left: 210rpx;
			}

			width: 100%;
			padding: 0 30rpx;
		}

		.title {
			.more {
				&::after {
					position: absolute;
					right: 4rpx;
					top: 50%;
					width: 12rpx;
					height: 12rpx;
					margin-top: -6rpx;
					border-top: 2rpx solid #999999;
					border-right: 2rpx solid #999999;
					transform: rotate(45deg);
					content: " ";
				}

				position: absolute;
				right: 30rpx;
				top: 50%;
				transform: translate(0, -50%);
				font-size: 24rpx;
				color: #999999;
				line-height:normal;
				padding: 2rpx 22rpx 2rpx 0;
			}

			position: relative;
			font-size: 34rpx;
			color: #333333;
			padding: 35rpx 30rpx;
		}

		width: 100%;
		background-color: #ffffff;
	}
</style>
